import { createRouter, createWebHistory } from "vue-router";
import Layout from "@/views/Layout";
import Login from "@/views/Login";
//() => import('../views/AboutView.vue')
import Home from "@/views/Home";
//产品
const Goods = () => import("@/views/Goods");
const List = () => import("@/views/Goods/list/GoodsList.vue");
const Category = () => import("@/views/Goods/category/Category.vue");
const AddGoods = () => import("@/views/Goods/list/AddGoods.vue");
//订单
const order = ()=>import('@/views/Order')
const orderlist = ()=>import('@/views/Order/list')
const collect = ()=>import('@/views/Order/collect')


const routes = [
  {
    path: "/",
    component: Layout,
    meta:{
      title:"首页"
    },
    children: [
      {
        path: "/",
        name: "home",
        component: Home,
        meta:{
          title:"首页"
        },
      },
      {
        path: "/goods",
        component: Goods,
        meta:{
          title:"产品管理"
        },
        children: [
          {
            path: "list",
            name: "list",
            component: List,
            meta:{
              title:"产品列表"
            },
          },
          {
            path: "category",
            name: "category",
            component: Category,
            meta:{
              title:"产品分类"
            },
          },
          {
            path: "addgoods",
            name: "addgoods",
            component: AddGoods,
            //路由元信息
            meta: {
              isShow: true,
              activeMenu: "/goods/list",
              title: "添加商品",
            },
          },
        ],
      },
      {
        path:'/order',
        component:order,
        meta:{
          title:'订单管理'
        },
        children:[
          {
            path:'orderlist',
            component:orderlist,
            meta:{
              title:'订单列表'
            }
          },
          {
            path:'collect',
            component:collect,
            meta:{
              title:'汇总清单'
            }
          }
        ]
      }
    ],
  },

  {
    path: "/login",
    name: "login",
    component: Login,
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
